package com.itqf.controller;

import org.springframework.web.bind.annotation.ExceptionHandler;

import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;

/**
 * projectName: springmvcgp8
 *
 * @author: 赵伟风
 * time: 2021/8/6 16:27
 * description:
 */
public class BaseController {

    /**
     * 当当前controller出现异常的时候，会执行此方法
     * @param re
     * @param request
     * @return
     */
    @ExceptionHandler
    public  Object  handleException(RuntimeException re, HttpServletRequest request)
    {

        Map<String,Object> map = new HashMap<>();
        map.put("error", 500);

        return map;
    }
}
